﻿using System;
using System.Configuration;

namespace com.hyrentals.webcommon.configuration
{
    public class WebConfig
    {
        private static RunModel m_runModel = RunModel.None;
        public static RunModel CurrentRunModel
        {
            get
            {
                if (m_runModel == RunModel.None)
                {
                    string runModelStr = ConfigurationManager.AppSettings["RunModel"];
                    if (string.IsNullOrEmpty(runModelStr))
                    {
                        m_runModel = RunModel.Debug;
                    }
                    else
                    {
                        RunModel tmpModel;
                        if (Enum.TryParse<RunModel>(runModelStr, out tmpModel))
                        {
                            m_runModel = tmpModel;
                        }
                    }
                }
                return m_runModel;
            }
        }
    }
}
